<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>title</title>


<script type="text/javascript" src="/tour/js/jquery.js"></script>
<script type="text/javascript" src="/tour/js/jquery-ui.js"></script>
<link type="text/css" href="/tour/css/jquery-ui.css" rel="stylesheet">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<link type="text/css" href="/tour/css/resistmember.css" rel="stylesheet">


</head>

<script type="text/javascript">
	$(document).ready(function(){
		$("#list").on("click", function(){
				$.ajax({
					"url":"/tour/customer/list.do",
					"type":"POST",
					"dataType":"JSON",
					"success":function(data){
						$("#thead").empty();
						$("#tbody").empty();
						$("#thead").append($("<tr>")
										.append($("<td>").text("ID"))
										.append($("<td>").text("Name"))
										.append($("<td>").text("Nickname"))
										.append($("<td>").text("탈퇴")));
						
						$.each(data, function(){
						
						$("#tbody").append($("<tr>")
									.append($("<td>").text(this.custId))
									.append($("<td>").text(this.custName))
									.append($("<td>").text(this.custNickname))
									.append($("<td><input type='button' id='bt' value='탈퇴' onclick='location.href=\"/tour/customer/listDelete.do?custId="+this.custId+"\"''>")));
						
						});
					}
				});
		});
	});
</script>




<script type="text/javascript">
	$(document).ready(function(){
		$("#nick").on("click", function(){
			$.ajax({
				"url":"/tour/customer/nick.do",
				"data":{"nickname":$("#trundle").val()},
				"type":"POST",
				"dataType":"JSON",
				"success":function(data){
					$("#thead").empty();
					$("#tbody").empty();
					$.each(data, function(){
					$("#thead").append($("<tr>")
									.append($("<td>").text("ID")));
					
					$("#tbody").append($("<tr>")
								.append($("<td>").text(this.custId)));
					
					});
				}
				
			});
		});
	});
</script>
<script type="text/javascript">
function popupAddress(){
	window.open("/tour/customer/address_popup.jsp","","width=500,height=400,resizable=no");
}
function passwordCheck(){
	if(!$("#password").val()){
		alert("비밀번호를 입력하세요");
		return false;
	}
}
</script>



<style type="text/css">

#container{
	width:1100px;
	
	margin:auto;/*센터로 정렬시킨다*/
}
#head{
	padding: 5px;
	height: 10px;
	text-align: right;	
	

}


#top{
	padding: 5px;
	text-align: center;	
	
	  /*border를 1px씩 주게 되면 width가 딱맞게 만들 경우 선때문에 outer공간이 모자라 모양이 깨진다.*/
}




#header{
	padding: 5px;
	text-align: center;	
/*	
	border:1px solid gray;
	*/
	  /*border를 1px씩 주게 되면 width가 딱맞게 만들 경우 선때문에 outer공간이 모자라 모양이 깨진다.*/
}



#left{
	padding: 5px;
	width:180px;/*height는 주지 않는다. 내용에 따라 늘어나도록 처리하기 위해*/
	float:left;/*경계선 때문에*/
	/*clear:both;*/
}

#content{
	padding: 5px;
	width:820px;/*height는 주지 않는다. 내용에 따라 늘어나도록 처리하기 위해*/
	height:700px;
	
	float:left;/*경계선 때문에*/
	/*clear:both;*/
}






#footer{
	padding-top:5px;
	
	clear:both;  /*이것이 없으면 left, content 아래로 들어가 버린다.*/
	text-align:center;
	height:50px;
}
</style>
</head>
<body>
<div id="container" >
	
	<div id="head">
		<jsp:include page="/templates/header.jsp"/>
	</div>
	
	<div id="top">
		<jsp:include page="/templates/top.jsp"/>
	</div>
	

	<div id="header">
		<jsp:include page="/templates/top_menu.jsp"/>
	</div>



	<div id="left" >
		<jsp:include page="/templates/banner.jsp"/>
		
	</div>
	
<div id="content" >
		
		
		
		
<c:choose>
<c:when test="${sessionScope.member.custName == '관리자' }">
	<h2>회원 관리</h2>
	 전체 회원 조회 <input type="button" value="회원조회" id="list" name="list"><br>
	닉네임으로 조회 :<input type="text" id="trundle"><input type="button" value="닉네임조회" id="nick" name="nick"><br>
	<form>
	<table align="center">
		<thead id="thead"></thead>
		<tbody id="tbody"></tbody>
	</table>
</form>

</c:when>
<c:otherwise>
	<form method="post" action="${initParam.rootPath }/customer/update.do" onsubmit="return passwordCheck()">
	<fieldset >
	<legend style="display: none;">회원가입 정보 입력 폼</legend>
		<table align="center">
			<thead><th colspan="2"><span id="tit_img3"></span></th></thead>
			<tbody>
				<tr>
					<td width="130" id="tit1"><span class="tit">ID :</span></td>
					<td><input type="text" name="id" readonly="readonly" value="${sessionScope.member.custId }"></td>
				</tr>
				<tr>
					<td id="tit8"><span class="tit">PASSWORD : </span></td>
					<td><input type="password" name="password" id="password"></td>
				</tr>
				<tr>
					<td id="tit2"><span class="tit">이름 :</span> </td>
					<td><input type="text" name="name" readonly="readonly" value="${sessionScope.member.custName }"></td>
				</tr>
				<tr>
					<td id="tit4"><span class="tit">닉네임 :</span></td>
					<td><input type="text" name="nickName" readonly="readonly" value="${sessionScope.member.custNickname }"></td>
				</tr>
				<tr>
					<td id="tit6"><span class="tit">E-Mail : </span></td>
					<td><input type="text" name="eMail" value="${sessionScope.member.custEmail }"></td>
				</tr>
				<tr>
					<td id="tit7"><span class="tit">핸드폰번호 :</span></td>
					<td><input type="text" name="phonNumber" value="${sessionScope.member.custPhonnum }"></td>
				</tr>
				<tr>
					<td id="tit11"><span class="tit">주소 : </span></td>
					<td><input type="text" name="zipCode" size="10" value="${sessionScope.member.custZipNum }">
					<input type="button" name="zipcode1" id="zipcode2" value="우편번호 찾기" onclick="popupAddress()"><br>
					<input type="text" name="Address" size="50" value="${sessionScope.member.custAddr }"></td>
				</tr>
			</tbody>
		</table>
		<input type="hidden" name="command" value="register">	
		<p id="btnArea">
			
		</p>
	</fieldset>
	<input type="submit" value="수정"/>
	<input type="reset" value="다시작성"/>
	<input type="button" value="회원탈퇴" onclick="location.href='/tour/customer/delete_form.jsp'"/>
	
	</form>

<p>

</c:otherwise>
</c:choose>







	<div id="footer" >
		<jsp:include page="/templates/footer.jsp"/>
	</div>
</div>

</body>
</html>


